/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pe.gov.mtc.dgac.licencias.bean;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author German
 */
@Entity
@Table(name = "TIPO_DOCUMENTO")
@NamedQueries({@NamedQuery(name = "TipoDocumentoTO.findByTipoIdDoc", query = "SELECT t FROM TipoDocumentoTO t WHERE t.tipoIdDoc = :tipoIdDoc"), @NamedQuery(name = "TipoDocumentoTO.findByDescripcion", query = "SELECT t FROM TipoDocumentoTO t WHERE t.descripcion = :descripcion"), @NamedQuery(name = "TipoDocumentoTO.findByEstado", query = "SELECT t FROM TipoDocumentoTO t WHERE t.estado = :estado")})
public class TipoDocumentoTO implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Column(name = "TIPO_ID_DOC", nullable = false)
    private Long tipoIdDoc;
    @Column(name = "DESCRIPCION", nullable = false)
    private String descripcion;
    @Column(name = "ESTADO", nullable = false)
    private String estado;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tipoIdDoc")
    private Collection<ClienteTO> clienteTOCollection;

    public TipoDocumentoTO() {
    }

    public TipoDocumentoTO(Long tipoIdDoc) {
        this.tipoIdDoc = tipoIdDoc;
    }

    public TipoDocumentoTO(Long tipoIdDoc, String descripcion, String estado) {
        this.tipoIdDoc = tipoIdDoc;
        this.descripcion = descripcion;
        this.estado = estado;
    }

    public Long getTipoIdDoc() {
        return tipoIdDoc;
    }

    public void setTipoIdDoc(Long tipoIdDoc) {
        this.tipoIdDoc = tipoIdDoc;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public String getEstado() {
        return estado;
    }

    public void setEstado(String estado) {
        this.estado = estado;
    }

    public Collection<ClienteTO> getClienteTOCollection() {
        return clienteTOCollection;
    }

    public void setClienteTOCollection(Collection<ClienteTO> clienteTOCollection) {
        this.clienteTOCollection = clienteTOCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (tipoIdDoc != null ? tipoIdDoc.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TipoDocumentoTO)) {
            return false;
        }
        TipoDocumentoTO other = (TipoDocumentoTO) object;
        if ((this.tipoIdDoc == null && other.tipoIdDoc != null) || (this.tipoIdDoc != null && !this.tipoIdDoc.equals(other.tipoIdDoc))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.dgac.licencias.to.TipoDocumentoTO[tipoIdDoc=" + tipoIdDoc + "]";
    }

}
